package com.sgb.kjwl.view.widget;

import android.content.Context;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.widget.ImageView;

import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.transport.MapGoodsBiddingEntity;
import com.sgb.kjwl.view.ui.adapter.transport.MapGoodsBiddingAdapter;
import com.swgk.core.dialog.BasePopWindow;
import com.swgk.core.dialog.PopViewHolder;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;

import java.util.List;

public class MapGoodsBiddingPopWindow extends BasePopWindow {

    private MapGoodsBiddingAdapter quotedPriceAdapter;

    public MapGoodsBiddingPopWindow(Context context) {
        super(context);
    }

    @Override
    protected int popLayout() {
        return R.layout.popwindow_goods_quoted_price3;
    }

    @Override
    protected void initView(PopViewHolder holder) {
        ImageView iv_close = holder.getPop().findViewById(R.id.pop_close);
        RecyclerView quotedPriceList = holder.getPop().findViewById(R.id.quoted_price_list);

        iv_close.setOnClickListener(view -> {
            dissMiss();
        });

        quotedPriceAdapter = new MapGoodsBiddingAdapter(mContext,null);
        quotedPriceList.setLayoutManager(new GridLayoutManager(mContext,1));
        quotedPriceList.setAdapter(quotedPriceAdapter);

        quotedPriceAdapter.setOnItemClick(new AdapterOnItemClick<MapGoodsBiddingEntity>() {
            @Override
            public void onItemClick(MapGoodsBiddingEntity goodsInfoEntity3, int position) {
                onResultClick.result(goodsInfoEntity3,null,null);
                dissMiss();
            }
        });
    }

    public void setDatas(List<MapGoodsBiddingEntity> list){
        quotedPriceAdapter.setDatas(list);
    }
}
